home *** CD-ROM | disk | FTP | other *** search
- program Project1;
-
- {$APPTYPE CONSOLE}
-
- uses
- SysUtils,
- Classes,
- AABufStm,
- AA6Pack in 'AA6Pack.pas',
- AAHuffmn in 'AAHuffmn.pas';
-
- var
- InStr : TFileStream;
- OutStr : TFileStream;
-
- InBufStm : TaaBufferedStream;
- OutBufStm : TaaBufferedStream;
- begin
- try
- writeln('SixBitPack compression test');
- writeln('Compressing...');
- InStr := TFileStream.Create('LLL.TXT', fmOpenRead);
- try
- OutStr := TFileStream.Create('LLL.SBP', fmCreate);
- try
- InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
- try
- OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
- try
- SixBitPackCompress(InBufStm, OutBufStm);
- finally
- OutBufStm.Free;
- end;
- finally
- InBufStm.Free;
- end;
- finally
- OutStr.Free;
- end;
- finally
- InStr.Free;
- end;
- writeln('Done');
-
- writeln('Decompressing...');
- InStr := TFileStream.Create('LLL.SBP', fmOpenRead);
- try
- OutStr := TFileStream.Create('LLL.STX', fmCreate);
- try
- InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
- try
- OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
- try
- SixBitPackDecompress(InBufStm, OutBufStm);
- finally
- OutBufStm.Free;
- end;
- finally
- InBufStm.Free;
- end;
- finally
- OutStr.Free;
- end;
- finally
- InStr.Free;
- end;
- writeln('Done');
-
- writeln('Huffman compression test');
- writeln('Compressing...');
- InStr := TFileStream.Create('LLL.TXT', fmOpenRead);
- try
- OutStr := TFileStream.Create('LLL.HUF', fmCreate);
- try
- InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
- try
- OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
- try
- HuffmanCompress(InBufStm, OutBufStm);
- finally
- OutBufStm.Free;
- end;
- finally
- InBufStm.Free;
- end;
- finally
- OutStr.Free;
- end;
- finally
- InStr.Free;
- end;
- writeln('Done');
-
- writeln('Decompressing...');
- InStr := TFileStream.Create('LLL.HUF', fmOpenRead);
- try
- OutStr := TFileStream.Create('LLL.HTX', fmCreate);
- try
- InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
- try
- OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
- try
- HuffmanDecompress(InBufStm, OutBufStm);
- finally
- OutBufStm.Free;
- end;
- finally
- InBufStm.Free;
- end;
- finally
- OutStr.Free;
- end;
- finally
- InStr.Free;
- end;
- writeln('Done');
- except
- on E:Exception do
- writeln(E.Message);
- end;
- readln;
- end.
-
-